home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 May / EnigmA AMIGA RUN 07 (1996)(G.R. Edizioni)(IT)[!][issue 1996-05][EARSAN CD VI].iso / progs / utilmisc / frontpub / frontpub_c / nbcrt0.s < prev   
Text File  |  1995-03-27  |  1KB  |  80 lines

  1. | stripped baserelative startup code for gcc v2.3.3
  2. | (c) by M.Fleischer and G.Nikl Wed Apr 13 17:45 1994
  3.  
  4. | some specific defines
  5.  
  6. _LVOForbid    =    -132
  7. _LVOFindTask    =    -294
  8. _LVOGetMsg    =    -372
  9. _LVOReplyMsg    =    -378
  10. _LVOWaitPort    =    -384
  11.  
  12. pr_MsgPort    =      92
  13. pr_CLI        =     172
  14.  
  15. RETURN_FAIL    =      20
  16.  
  17.         .text
  18.  
  19. | public symbols
  20.  
  21.         .globl    __exit
  22.  
  23. | first entry - init some vars, check for cli or wb start
  24.  
  25. start:        moveml    d2/a2/a6,sp@-
  26.  
  27.         lea    ___a4_init,a4
  28.  
  29.         movew    #___bss_size,d1
  30.         beqs    nobss
  31.         lea    a4@(__edata:W),a1
  32. clrbss:        clrl    a1@+
  33.         subqw    #4,d1
  34.         bnes    clrbss
  35.  
  36. nobss:        movel    sp,a4@(___SaveSP:W)
  37.         movel    4:W,a6
  38.         movel    a6,a4@(_SysBase:W)
  39.         subal    a1,a1
  40.         jsr    a6@(_LVOFindTask:W)
  41.         movel    d0,a2
  42.         tstl    a2@(pr_CLI:W)
  43.         bnes    fromCLI
  44.  
  45. | wb start - get wbmsg
  46.  
  47. fromWB:        lea    a2@(pr_MsgPort:W),a0
  48.         jsr    a6@(_LVOWaitPort:W)
  49.         lea    a2@(pr_MsgPort:W),a0
  50.         jsr    a6@(_LVOGetMsg:W)
  51.         movel    d0,a4@(__WBenchMsg:W)
  52.  
  53. | call _main - push args onto stack
  54.  
  55. fromCLI:    jbsr    __main
  56.  
  57. | exit() entry - close libs, reply wbmsg
  58.  
  59. __exit:        movel    a4@(_SysBase:W),a6
  60.  
  61.         movel    a4@(__WBenchMsg:W),d2
  62.         beqs    todos
  63.         jsr    a6@(_LVOForbid:W)
  64.         movel    d2,a1
  65.         jsr    a6@(_LVOReplyMsg:W)
  66.  
  67. todos:        moveq    #0,d0
  68.         movel    a4@(___SaveSP:W),sp
  69.  
  70.         moveml    sp@+,d2/a2/a6
  71.         rts
  72.  
  73. | data area
  74.  
  75.         .data
  76.  
  77. .comm        _SysBase,4
  78. .comm        ___SaveSP,4
  79. .comm        __WBenchMsg,4
  80.